// pages/appointmentSearch/appointmentSearch.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
      appList: ""
  },

  onTabItemTap() {
    let userInfo = wx.getStorageSync('userInfo')
    if(!userInfo) {
      wx.navigateTo({
        url: '../login/login',
      })
    }else{
      let userInfo = wx.getStorageSync('userInfo')
      wx.request({
        url: 'https://118.31.170.229:5001/api/ZshRegister/GetRegisterBriefs',
        methodL: 'get',
        data: {
          userId : userInfo.id
        },
        success: (res) => {
          console.log(res)
            this.setData({
              appList : res.data
            })
        },
      })
    }
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
   
      // console.log(userInfo.id)
     
    
    
  },

  appDetail(data) {
    console.log(data)
    // console.log(data.target.dataset.stockid.state)
    let state = data.target.dataset.stockid.state
    // let userInfo = wx.getStorageSync('userInfo')
    let registerId = data.target.dataset.stockid.registerId
    let stockId = data.target.dataset.stockid.stockId
    // console.log(state)
    // console.log(userId)
    // console.log(stockId)
    if(state == 0) {
        wx.navigateTo({
        url: '../zshAppResult/zshAppResult?id='+registerId+'&stockId='+stockId,
        })
    }else {
      wx.navigateTo({
        url: '../zshAppResult2/zshAppResult2?id='+registerId+'&stockId='+stockId,
        })
    }
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    
    // let userInfo = wx.getStorageSync('userInfo')
    // console.log(userInfo)
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})